<template>
  <div>分类页</div>
  <Categorychild @myevent="getvalue"></Categorychild>
  <p v-if="(user as userprops).username">{{ (user as userprops).username }}--{{ (user as userprops).age }}</p>
</template>

<script setup lang='ts'>
import { ref } from 'vue';

// 导入子组件
import Categorychild from '@/components/Categorychild.vue'
const user = ref({})
// 设置ts类型
interface userprops {
  username: string
  age: number
}
const getvalue = (data: userprops) => {
  console.log('data', data)
  user.value = data
}
</script>
<style scoped></style>